/*****************************************************************
**                                                             	**
**  Copyright (C) 2004 Amlogic,Inc.                            	**
**  All rights reserved                                        	**
**        Filename : NumberKeyBoard.c /Project:AVOS		       **
**        Revision : 1.0                                       	**
**                                                             	**
*****************************************************************/
#ifdef ENABLE_NETWORK
#include "../menu.h"
#include "NumberKeyBoardEvent.h"

INT32S WinNumberKeyBoardMsgProc(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
            return WinNumberKeyBoardOnShow(hwnd, lpParam) ;
        case WM_HIDEWINDOW:
	     return WinNumberKeyBoardOnHide(hwnd, lpParam) ;
    }
    return 0 ;
}

void SetWinNumberKeyBoardPalette(void)
{
    YUVENTRY mask_para[4] = {0,0,0,4095};
    AWSetAlphaMask(0,4, mask_para);
    YUVENTRY palette_para[16] = {0x8000 | 16392,0x8000 | 17848,0x8000 | 22116,0x8000 | 18424,16392,18152,22116,19656,19992,18104,17673,17817,15864,15721,15912,16344};
    AWSetPalette(0,16, palette_para);
    return ;
}

void SetWinNumberKeyBoardPos(HWND* pControl, INT8U CurOsdSize)
{

            RECT StandardWindowRect = {0,0,720,480};
            pControl->winrect = StandardWindowRect;
            CREATEWINDOWPARAM StandardWindowPara = {1,{{0,0,720,480},{0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},SetWinNumberKeyBoardPalette};
            AWSendMessage(pControl, WM_WINDOW_RESET_DRAW_AREA, (INT32S)&StandardWindowPara);

    return;
}

HWND *CreateControlWinNumberKeyBoard(HWND* pParent)
{
    HWND* pNewControl;
    CREATEWINDOWPARAM window_para = {1,{{0,0,720,480},{0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},SetWinNumberKeyBoardPalette};
    //Create Menu Window -- 1
    pNewControl = AWCreateWinControl("TWindow","WinNumberKeyBoard",WS_OVERLAPPEDWINDOW,
		         0,0,720,480,NULL, (INT32S)&window_para,WinNumberKeyBoardMsgProc) ;
    pNewControl->win_id = 0 ;
    return pNewControl;
}

void SetNumberKeyBoard_CaptionPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;

            pControl->winrect.top = pControl->parent->winrect.top + 0;
            pControl->winrect.left = pControl->parent->winrect.left + 0;
            pControl->winrect.width = 720;
            pControl->winrect.height = 78;
            pControl->draw_info_num = 3;
            RECT StandardDrawRect[3] = {
            {pControl->winrect.left + 0,pControl->winrect.top + 0,136,78},
            {pControl->winrect.left + 550,pControl->winrect.top + 30,100,30},
            {pControl->winrect.left + 550,pControl->winrect.top + 30,100,28},
            };
            for(iLoop=0; iLoop < 3; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &StandardDrawRect[iLoop], sizeof(RECT));
          
    return;
}

INT32S NumberKeyBoard_CaptionMsgProc(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
            return NumberKeyBoard_CaptionOnShow(hwnd, lpParam) ;
        case WM_PAINT:
            return NumberKeyBoard_CaptionOnPaint(hwnd, lpParam) ;
    }
    return 0 ;
}

HWND *CreateControlNumberKeyBoard_Caption(HWND *pParent)
{
    //Create Control -- NumberKeyBoard_Caption
    HWND *pNewControl = AWCreateWinControl("TControl","NumberKeyBoard_Caption",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		           0,0,720,78,pParent,0,NumberKeyBoard_CaptionMsgProc) ;
    pNewControl->win_id = 1 ;
    pNewControl->draw_info_num = 3;
   pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
       DRAWINFO StandardDrawDatas[3] = {
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},
                          {0,0,0,0,(INT32U)0,DT_RESOURCE_STRING_DATA}};
            memcpy(pNewControl->draw_info,StandardDrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;

    return pNewControl;
}


#define X_OFFSET 18
#define Y_OFFSET 14

void SetNumberKeyBoardBarPos(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;

            pControl->winrect.top = pControl->parent->winrect.top + 0;
            pControl->winrect.left = pControl->parent->winrect.left + 0;
            pControl->winrect.width = 720;
            pControl->winrect.height = 480;
            pControl->draw_info_num = 59;
            RECT StandardDrawRect[59] = {
#ifdef ENABLE_NETWORK 				
            {pControl->winrect.left + 0,pControl->winrect.top + 0,720,480},
            {pControl->winrect.left + 162+X_OFFSET,pControl->winrect.top + 88-Y_OFFSET,144,34},
            {pControl->winrect.left + 307+X_OFFSET+6,pControl->winrect.top + 88-Y_OFFSET,144,34},
            {pControl->winrect.left + 452+X_OFFSET+12,pControl->winrect.top + 88-Y_OFFSET,144,34},
            {pControl->winrect.left + 597+X_OFFSET+18,pControl->winrect.top + 88-Y_OFFSET,144,34},
            
            {pControl->winrect.left + 162+X_OFFSET,pControl->winrect.top + 134-Y_OFFSET,144,34},
            {pControl->winrect.left + 307+X_OFFSET+6,pControl->winrect.top + 134-Y_OFFSET,144,34},
            {pControl->winrect.left + 452+X_OFFSET+12,pControl->winrect.top + 134-Y_OFFSET,144,34},
            {pControl->winrect.left + 597+X_OFFSET+18,pControl->winrect.top + 134-Y_OFFSET,144,34},
            
            {pControl->winrect.left + 162+X_OFFSET,pControl->winrect.top + 180+2-Y_OFFSET-2,144,34},
            {pControl->winrect.left + 307+X_OFFSET+6,pControl->winrect.top + 180+2-Y_OFFSET-2,144,34},
            {pControl->winrect.left + 452+X_OFFSET+12,pControl->winrect.top + 180+2-Y_OFFSET-2,144,34},
            {pControl->winrect.left + 597+X_OFFSET+18,pControl->winrect.top + 180+2-Y_OFFSET-2,144,34},
            
            {pControl->winrect.left + 162+X_OFFSET,pControl->winrect.top + 226-Y_OFFSET-2,144,34},
            {pControl->winrect.left + 307+X_OFFSET+6,pControl->winrect.top + 226-Y_OFFSET-2,144,34},
            {pControl->winrect.left + 452+X_OFFSET+12,pControl->winrect.top + 226-Y_OFFSET-2,144,34},
            {pControl->winrect.left + 597+X_OFFSET+18,pControl->winrect.top + 226-Y_OFFSET-2,144,34},
            
            
            
            {pControl->winrect.left + 246,     pControl->winrect.top + 262,68,40},
            {pControl->winrect.left + 294+13,pControl->winrect.top + 262,68,40},
            {pControl->winrect.left + 355+13,pControl->winrect.top + 262,68,40},
            {pControl->winrect.left + 416+10,pControl->winrect.top + 262,68,40},
            {pControl->winrect.left + 477+8,pControl->winrect.top + 262,68,40},
            
            {pControl->winrect.left + 246,     pControl->winrect.top + 314,68,40},
            {pControl->winrect.left + 294+13,pControl->winrect.top + 314,68,40},
            {pControl->winrect.left + 355+13,pControl->winrect.top + 314,68,40},
            {pControl->winrect.left + 416+10,pControl->winrect.top + 314,68,40},
            {pControl->winrect.left + 477+8,pControl->winrect.top + 314,68,40},
            
            
            {pControl->winrect.left + 252,pControl->winrect.top + 370,110,40},
            {pControl->winrect.left + 352,pControl->winrect.top + 370,110,40},
            {pControl->winrect.left + 444,pControl->winrect.top + 370,110,40},
            
            
            {pControl->winrect.left + 162+40,pControl->winrect.top + 88+2-Y_OFFSET,100,30},
            {pControl->winrect.left + 307+40,pControl->winrect.top + 88+2-Y_OFFSET,100,30},
            {pControl->winrect.left + 452+40,pControl->winrect.top + 88+2-Y_OFFSET,100,30},
            {pControl->winrect.left + 597+40,pControl->winrect.top + 88+2-Y_OFFSET,100,30},
            
            {pControl->winrect.left + 162+40,pControl->winrect.top + 134+2-Y_OFFSET,100,30},
            {pControl->winrect.left + 307+40,pControl->winrect.top + 134+2-Y_OFFSET,100,30},
            {pControl->winrect.left + 452+40,pControl->winrect.top + 134+2-Y_OFFSET,100,30},
            {pControl->winrect.left + 597+40,pControl->winrect.top + 134+2-Y_OFFSET,100,30},
            
            {pControl->winrect.left + 162+40,pControl->winrect.top + 180+4-Y_OFFSET,100,30},
            {pControl->winrect.left + 307+40,pControl->winrect.top + 180+4-Y_OFFSET,100,30},
            {pControl->winrect.left + 452+40,pControl->winrect.top + 180+4-Y_OFFSET,100,30},
            {pControl->winrect.left + 597+40,pControl->winrect.top + 180+4-Y_OFFSET,100,30},
            
            {pControl->winrect.left + 162+40,pControl->winrect.top + 226+2-Y_OFFSET,100,30},
            {pControl->winrect.left + 307+40,pControl->winrect.top + 226+2-Y_OFFSET,100,30},
            {pControl->winrect.left + 452+40,pControl->winrect.top + 226+2-Y_OFFSET,100,30},
            {pControl->winrect.left + 597+40,pControl->winrect.top + 226+2-Y_OFFSET,100,30},
            
            {pControl->winrect.left + 216+50,pControl->winrect.top + 272+5,40,30},
            {pControl->winrect.left + 274+53,pControl->winrect.top + 272+5,40,30},
            {pControl->winrect.left + 345+43,pControl->winrect.top + 272+5,40,30},
            {pControl->winrect.left + 416+33,pControl->winrect.top + 272+5,40,30},  
            {pControl->winrect.left + 487+23,pControl->winrect.top + 272+5,40,30},
            
            {pControl->winrect.left + 216+50,pControl->winrect.top + 324+5,40,30},
            {pControl->winrect.left + 274+53,pControl->winrect.top + 324+5,40,30},
            {pControl->winrect.left + 345+43,pControl->winrect.top + 324+5,40,30},
            {pControl->winrect.left + 416+33,pControl->winrect.top + 324+5,40,30},
            {pControl->winrect.left + 487+23,pControl->winrect.top + 324+5,40,30},
            
            {pControl->winrect.left + 222+50,pControl->winrect.top + 380+5,70,30},
            {pControl->winrect.left + 332+40,pControl->winrect.top + 380+5,70,30},
            {pControl->winrect.left + 442+28,pControl->winrect.top + 380+5,70,30},
 #else
            {pControl->winrect.left + 0,pControl->winrect.top + 0,720,480},
            {pControl->winrect.left + 162,pControl->winrect.top + 88,144,34},
            {pControl->winrect.left + 307,pControl->winrect.top + 88,144,34},
            {pControl->winrect.left + 452,pControl->winrect.top + 88,144,34},
            {pControl->winrect.left + 597,pControl->winrect.top + 88,144,34},
            
            {pControl->winrect.left + 162,pControl->winrect.top + 134,144,34},
            {pControl->winrect.left + 307,pControl->winrect.top + 134,144,34},
            {pControl->winrect.left + 452,pControl->winrect.top + 134,144,34},
            {pControl->winrect.left + 597,pControl->winrect.top + 134,144,34},
            
            {pControl->winrect.left + 162,pControl->winrect.top + 180+2,144,34},
            {pControl->winrect.left + 307,pControl->winrect.top + 180+2,144,34},
            {pControl->winrect.left + 452,pControl->winrect.top + 180+2,144,34},
            {pControl->winrect.left + 597,pControl->winrect.top + 180+2,144,34},
            
            {pControl->winrect.left + 162,pControl->winrect.top + 226,144,34},
            {pControl->winrect.left + 307,pControl->winrect.top + 226,144,34},
            {pControl->winrect.left + 452,pControl->winrect.top + 226,144,34},
            {pControl->winrect.left + 597,pControl->winrect.top + 226,144,34},
            
            
            
            {pControl->winrect.left + 186,     pControl->winrect.top + 272,68,40},
            {pControl->winrect.left + 254+13,pControl->winrect.top + 272,68,40},
            {pControl->winrect.left + 335+13,pControl->winrect.top + 272,68,40},
            {pControl->winrect.left + 416+13,pControl->winrect.top + 272,68,40},
            {pControl->winrect.left + 497+13,pControl->winrect.top + 272,68,40},
            
            {pControl->winrect.left + 186,     pControl->winrect.top + 324,68,40},
            {pControl->winrect.left + 254+13,pControl->winrect.top + 324,68,40},
            {pControl->winrect.left + 335+13,pControl->winrect.top + 324,68,40},
            {pControl->winrect.left + 416+13,pControl->winrect.top + 324,68,40},
            {pControl->winrect.left + 497+13,pControl->winrect.top + 324,68,40},
            
            
            {pControl->winrect.left + 202,pControl->winrect.top + 380,110,40},
            {pControl->winrect.left + 322,pControl->winrect.top + 380,110,40},
            {pControl->winrect.left + 442,pControl->winrect.top + 380,110,40},
            
            
            {pControl->winrect.left + 162+40,pControl->winrect.top + 88+2,100,30},
            {pControl->winrect.left + 307+40,pControl->winrect.top + 88+2,100,30},
            {pControl->winrect.left + 452+40,pControl->winrect.top + 88+2,100,30},
            {pControl->winrect.left + 597+40,pControl->winrect.top + 88+2,100,30},
            
            {pControl->winrect.left + 162+40,pControl->winrect.top + 134+2,100,30},
            {pControl->winrect.left + 307+40,pControl->winrect.top + 134+2,100,30},
            {pControl->winrect.left + 452+40,pControl->winrect.top + 134+2,100,30},
            {pControl->winrect.left + 597+40,pControl->winrect.top + 134+2,100,30},
            
            {pControl->winrect.left + 162+40,pControl->winrect.top + 180+4,100,30},
            {pControl->winrect.left + 307+40,pControl->winrect.top + 180+4,100,30},
            {pControl->winrect.left + 452+40,pControl->winrect.top + 180+4,100,30},
            {pControl->winrect.left + 597+40,pControl->winrect.top + 180+4,100,30},
            
            {pControl->winrect.left + 162+40,pControl->winrect.top + 226+2,100,30},
            {pControl->winrect.left + 307+40,pControl->winrect.top + 226+2,100,30},
            {pControl->winrect.left + 452+40,pControl->winrect.top + 226+2,100,30},
            {pControl->winrect.left + 597+40,pControl->winrect.top + 226+2,100,30},
            
            {pControl->winrect.left + 186+20,pControl->winrect.top + 272+5,40,30},
            {pControl->winrect.left + 254+33,pControl->winrect.top + 272+5,40,30},
            {pControl->winrect.left + 335+33,pControl->winrect.top + 272+5,40,30},
            {pControl->winrect.left + 416+33,pControl->winrect.top + 272+5,40,30},
            {pControl->winrect.left + 497+33,pControl->winrect.top + 272+5,40,30},
            
            {pControl->winrect.left + 186+20,pControl->winrect.top + 324+5,40,30},
            {pControl->winrect.left + 254+33,pControl->winrect.top + 324+5,40,30},
            {pControl->winrect.left + 335+33,pControl->winrect.top + 324+5,40,30},
            {pControl->winrect.left + 416+33,pControl->winrect.top + 324+5,40,30},
            {pControl->winrect.left + 497+33,pControl->winrect.top + 324+5,40,30},
            
            {pControl->winrect.left + 202+20,pControl->winrect.top + 380+5,70,30},
            {pControl->winrect.left + 322+20,pControl->winrect.top + 380+5,70,30},
            {pControl->winrect.left + 442+20,pControl->winrect.top + 380+5,70,30},
         

 #endif
            };
            for(iLoop=0; iLoop < 59; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &StandardDrawRect[iLoop], sizeof(RECT));

    return;
}

INT32S NumberKeyBoardBarMsgProc(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
            return NumberKeyBoardBarOnShow(hwnd, lpParam) ;
        case WM_PAINT:
            return NumberKeyBoardBarOnPaint(hwnd, lpParam) ;
        case WM_KEYDOWN:
            return NumberKeyBoardBarOnKeyPress(hwnd, lpParam) ;
    }
    return 0 ;
}

HWND *CreateControlNumberKeyBoardBar(HWND *pParent)
{
    //Create Control -- NumberKeyBoardBar
    HWND *pNewControl = AWCreateWinControl("TControl","NumberKeyBoardBar",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		         0,0,720,480,pParent,0,NumberKeyBoardBarMsgProc) ;
    pNewControl->win_id = 3 ;
    pNewControl->draw_info_num = 59;
    pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
    DRAWINFO DrawDatas[59] = {
        {0,0,0,0,(INT32U)ICON_NUMBERKEYBOARD_BK,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_TOP,DT_RLE_BMP_DATA},
                
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_FOCUS,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_SHORT_LOSE,DT_RLE_BMP_DATA},
        
        {0,0,0,0,(INT32U)ICON_NUMKEY_LONG_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_LONG_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)ICON_NUMKEY_LONG_LOSE,DT_RLE_BMP_DATA},
        {0,0,0,0,(INT32U)number_key_str[0],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[1],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[2],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[3],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[4],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[5],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[6],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[7],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[8],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[9],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[10],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[11],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[12],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[13],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[14],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[15],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[16],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[17],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[18],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[19],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[20],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[21],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[22],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[23],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[24],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[25],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[26],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[27],DT_STRING_DATA},
        {0,0,0,0,(INT32U)number_key_str[28],DT_STRING_DATA},
        
        
        
        
        };
    memcpy(pNewControl->draw_info, DrawDatas, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;

    return pNewControl;
}

HWND* CreateMenuWinNumberKeyBoard(void)
{
    HWND *pNewControl ;
    TWINDOWS *pWin;
    HWND *pWinNumberKeyBoard = CreateControlWinNumberKeyBoard(NULL);
    SetWinNumberKeyBoardPos(pWinNumberKeyBoard,CurrentOsdSize);

    pNewControl= CreateControlNumberKeyBoard_Caption(pWinNumberKeyBoard);
    SetNumberKeyBoard_CaptionPos(pNewControl,CurrentOsdSize);



    pNewControl= CreateControlNumberKeyBoardBar(pWinNumberKeyBoard);
    SetNumberKeyBoardBarPos(pNewControl,CurrentOsdSize);

    pWin = (TWINDOWS *)pWinNumberKeyBoard;
    pWin->pFocusControl = AWFindWinCtrlByName("NumberKeyBoardBar");
    return pWinNumberKeyBoard;
}

void WinResetWinNumberKeyBoardControlsPos(HWND *pControl, INT8U CurOsdSize)
{
    switch(pControl->win_id){
        case 0://WinNumberKeyBoard
            SetWinNumberKeyBoardPos(pControl,CurOsdSize) ;
            break ;
        case 1://NumberKeyBoard_Caption
            SetNumberKeyBoard_CaptionPos(pControl,CurOsdSize) ;
            break ;

        case 3://NumberKeyBoardBar
            SetNumberKeyBoardBarPos(pControl,CurOsdSize) ;
            break ;
    }//end of switch
}
void WinResetWinNumberKeyBoardPos(HWND *pControl, INT8U CurOsdSize)
{
    HWND *pChildControl;
    if(pControl == NULL)
        pControl = AWFindWinCtrlByName("WinNumberKeyBoard");
    if(pControl == NULL) return ;

    WinResetWinNumberKeyBoardControlsPos(pControl, CurOsdSize) ;
    pChildControl = pControl->children ;
    while(pChildControl != NULL){
    	WinResetWinNumberKeyBoardPos(pChildControl, CurOsdSize) ;
    	pChildControl = pChildControl->siblings ;
	}
	return ;
}
#endif
